package com.zige.zige.task;


import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by kim-wu on 2015/3/27.
 */
public class TaskExecutor {
    private static TaskExecutor ourInstance = new TaskExecutor();

    private ExecutorService executorService;

    public static TaskExecutor getInstance() {
        return ourInstance;
    }

    private TaskExecutor() {
        executorService= Executors.newCachedThreadPool();
    }

    public void execute(Runnable task){
        if (executorService!=null)
            executorService.submit(task);
    }

    public void shundown(){
        if (executorService!=null)
            executorService.shutdown();

    }

}
